<%= stylesheet_link_tag 'survey_ul'%>
<%= stylesheet_link_tag 'faux_table'%>
<div class="show_basic" style="padding-right: 2em;">
	
	<p>
        <b>Term(s):</b> <%= h @search.terms -%>
      </p>
	<p>
        <b>Date of search:</b> <%= h @search.created_at -%>
      </p>

	<p>
        <b>Number of variables:</b> <%= h @search.variables.size -%>
      </p>


<% form_remote_tag :url => { :action => "add_to_cart"} do -%>
  <%= hidden_field_tag 'submit', 'add' %>
  <%= hidden_field_tag 'from_a_previous_search', @search.id %>
  <br/>
  <table style="background-color:#ACCBE0;width:100%;padding-bottom:5px;
         padding-left:5px;
         padding-top:5px;">
    <tr><td style="text-align:left;"><%= submit_tag'Add selected variables to cart', :name=>"_submit", :onclick => "Form.getInputs(this.form, null,'submit')[0].value = 'add';" -%></td>
    <td><div id="cart_button">
		    <%= render :partial => "cart/button" -%>
		  </div>
		</td>
    </tr>
    <tr><td style="text-align:left;"> Select:
        <%= link_to_function 'All', "$$('input.variable_checkbox').each(function(checkbox) { checkbox.checked = true; });" %>
        ,&nbsp
        <%= link_to_function 'None', "$$('input.variable_checkbox').each(function(checkbox) { checkbox.checked = false; });" %>
        ,&nbsp
        <%= link_to_function 'Invert selection', "$$('input.variable_checkbox').each(function(checkbox) { if (checkbox.checked == true) {checkbox.checked = false;} else {checkbox.checked = true; } });" %>

      </td></tr>
  </table>
	<p>
    <b>Variables found:</b>
  </p>
  <br/>
  <div id="table_header" class="faux_table_header_container">
    <%= render :partial => "surveys/table_header",:locals=>{:sorted_variables => @search.variables} -%>
  </div>
  <div id="table_container" class="faux_table_container">
    <%= render :partial => "surveys/table",:locals=>{:sorted_variables => @search.variables, :lineage => false, :extract_lineage => false, :extract_id => nil} -%>

  </div>
  <br/>

<% end %>
</div>